require File.dirname(__FILE__)+'/../lib/std_lib.rb'
require File.dirname(__FILE__)+'/../lib/reporting.rb'
require File.dirname(__FILE__)+'/../lib//testdata/testdata.rb'
require 'watir'
require 'watir/testcase'
require File.dirname(__FILE__)+'/../lib/elements/Homepage/element_Homepage.rb'
require File.dirname(__FILE__)+'/../lib/elements/Accounts/element_Accounts.rb'
#How to definite the variable for part of ie
=begin
class Login_Test < Watir::TestCase
    def test_setup
        #OCRM_STD_LIB.login($product,$username,$password)
        filename  = File.basename(__FILE__).gsub(/\.rb/, "")
        begin
            $log=Reporting.new(File.dirname(__FILE__)+'/../doc/report/'"",filename)

        rescue
            puts $!
            puts $@
            $log.close unless $log.nil?
        end

    end

    def test_result
        $log.test_notes("Test OracleCRM")
        $log.test_notes("Start To Test ")
        for i in 1..2000
            OCRM_STD_LIB.login($product,$username,$password)
            t=Time.now.strftime("%m/%d %H:%M:%S")
            $log.test_notes(t)
            $log.test_notes("Round"+" "+i.to_s+t)
            $log.test_validate($ie.title.eql?("Home - Oracle CRM On Demand"), "Login Success or not")

            #Element::Header_Link.sign_out.click
            sleep 60

            $ie.close
            
           
        end

        
    end

end
class NewLogin < Watir::TestCase

    def test_setup

    end

    def test_tear_down
        $log.close unless $log.nil?
    end
end
=end
=begin
#Quick Create account of Active.Com
$ie = Watir::IE.attach(:title,"Accounts - Oracle CRM On Demand")
Element::CreateAccounts.account_name_text_field.set("Tonytest_OCRM1356_USA")
Element::CreateAccounts.operating_unit_name_select_list.set("Active.Com")
Element::CreateAccounts.operating_unit_id_select_list.set("86")
Element::CreateAccounts.market_1_select_list.select("Campgrounds")
Element::CreateAccounts.sub_market_1_select_list.set("Boat Licensing Departments")
Element::CreateAccounts.market_priority_1_select_list.set("A")
Element::CreateAccounts.market_status_1_select_list.set("Customer")
Element::CreateAccounts.bill_to_country_select_list.set("USA")
Element::CreateAccounts.bill_to_number_street_text_field.set("4570 Walnut Street")
Element::CreateAccounts.bill_to_address_2_text_field.set("1 Test")
Element::CreateAccounts.bill_to_city_text_field.set("Boulder")
Element::CreateAccounts.bill_to_county_text_field.set("Boulder")
Element::CreateAccounts.bill_to_state_select_list.set("CO")
Element::CreateAccounts.bill_to_zip_text_field.set("80301")
Element::CreateAccounts.save_button.click
=end
=begin
#Quick Creat account of CAD
$ie = Watir::IE.attach(:title,"Accounts - Oracle CRM On Demand")
$ie.bring_to_front
Element::CreateAccounts.account_name_text_field.set("Tonytest_OCRM1356_CAN")
Element::CreateAccounts.operating_unit_name_select_list.set("Canada Operating Unit")
Element::CreateAccounts.operating_unit_id_select_list.set("97")
Element::CreateAccounts.market_1_select_list.select("Campgrounds")
Element::CreateAccounts.sub_market_1_select_list.set("Boat Licensing Departments")
Element::CreateAccounts.market_priority_1_select_list.set("A")
Element::CreateAccounts.market_status_1_select_list.set("Customer")
sleep 5
Element::CreateAccounts.bill_to_country_select_list.select("Canada")
sleep 5
Element::CreateAccounts.bill_to_number_street_text_field.set("111 Robson ST")
Element::CreateAccounts.bill_to_address_2_text_field.set("1 Test")
Element::CreateAccounts.bill_to_city_text_field.set("Vancouver")
Element::CreateAccounts.bill_to_province_text_field.set("British Columbia")
#Bugs about Select countries
Element::CreateAccounts.bill_to_zip_text_field.set("V6G3H7")
Element::CreateAccounts.save_button.click
=end
ie = Watir::IE.attach(:title,"Home")
